public class IsSubsequence {

    public boolean isSubsequence (String S, String T) {
        int i = 0;
        int j = 0;
        while(i < S.length() && j < T.length()) {
            if(S.charAt(i) != T.charAt(j)) {
                    j++;
            }else {
                i++;
                j++;
            }
        }
        if(i == S.length()) {
            return true;
        }
        return false;
    }
}